package com.net.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.net.dao.UserDao;
import com.net.model.User;
import com.net.service.UserService;
@Component("userService")
public class UserServiceImpl implements UserService {
	private UserDao userDao ;

	public UserDao getUserDao() {
		return userDao;
	}
	@Resource(name="userDao")
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	public boolean delete(User u) {
		return userDao.delete(u);
	}
	public List<User> getUsers(int currentPage, int perPage, String orderType,
			String orderName) {
		return userDao.getUsers(currentPage, perPage, orderType, orderName);
	}
	public List<User> getUsersByCondition(int currentPage, int perPage,
			String condition) {
		return userDao.getUsersByCondition(currentPage, perPage, condition);
	}
	public User loadUserById(int id) {
		return userDao.loadUserById(id);
	}
	public User loadUserByName(String name) {
		return userDao.loadUserByName(name);
	}
	public void add(User u) {
		userDao.save(u);
	}
	public void update(User user) {
		userDao.update(user);
	}
	public int getCount(){
		return userDao.getCount();
	}
}
